package com.mooc.house.api.dao;

import com.mooc.house.api.common.RestResponse;
import com.mooc.house.api.config.GenericRest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Repository;

@Repository
public class UserDao {

    @Autowired
    private GenericRest rest;

    public String getusername(Long id){
        String url = "http://user/getusername?id="+id;
        RestResponse<String> response = rest.get(url,
                new ParameterizedTypeReference<RestResponse<String>>() {
        }).getBody();
        return response.getResult();
    }


}
